package cn.xf.demo.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/demo")
public class DemoController {

    @Autowired
    private Environment environment;

    @Value("${yr.username}")
    private String val;

    @RequestMapping("/config")
    public String getConfig() {

        log.info(val);
        log.info("yr.username={}", environment.getProperty("yr.username"));
        log.info("mail.pwd={}", environment.getProperty("mail.pwd"));
        log.info("mail.address={}", environment.getProperty("mail.address"));
        return "hello";
    }
}
